<template>
<el-dialog :append-to-body="true" :title="confirmObj.title" :visible.sync="confirmObj.show" width="418px" :close-on-click-modal="false">
    <el-input :maxlength="confirmObj.size" clearable :placeholder="confirmObj.placeholder" v-model="confirmObj.value"></el-input>
    <span slot="footer" class="dialog-footer">
      <el-button @click="confirmObj.show=false">取 消</el-button>
      <el-button type="primary" v-preventReClick="2000" @click="handleConfirm">确 定</el-button>
    </span>
</el-dialog>
</template>

<script>
export default {
    name: 'AddExp',
    props: {
        confirmObj: {
            type: Object,
            required: true
        }
    },
    methods: {
        handleConfirm () {
            if (this.confirmObj.value) {
                this.$emit('save', this.confirmObj.value)
            } else {
                this.$message.error(this.confirmObj.placeholder)
            }
        }
    }
}
</script>
